﻿$(function(){
    function remove(obj){
        obj.slideUp("slow", function () {
            obj.remove();
        });
    }
    /*-------------------*/
    
    $(".product-del").click(function(){
        var obj = $(this);
        if (confirm("Bạn có chắc xóa dữ liệu?")){
            $(this).addClass("del-active");
            var jsonStr = "{id:'" + obj.attr("id") + "'}";

            $.ajax({
                type: "POST",
                url: "/Admin/Webservice/WebService.asmx/DeleteProduct",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: jsonStr,
                success: function(msg) {
                    obj.removeClass("del-active");
                    obj.parent().parent().remove();
                    loadTable();
                    return true;
                },
                error: function() {
                    obj.removeClass("del-active");
                    return false;
                }
            });
        }
   }); 
});